<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="commons/css::css">head</th:block>
</head>

<body class="flat-blue">
<i style="display: none;" id="_manager_url" url="/suit/manager"></i>
<div class="app-container">
    <div class="row content-container">
        <th:block th:include="commons/nav_head::nav">head</th:block>
        <th:block th:include="commons/side::side">side</th:block>
        <!-- Main Content -->
        <div class="container-fluid">
            <div class="side-body">
                <div class="row">
                    <div class="col-xs-12">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                套装信息
                            </div>
                            <div class="panel-body form-group table-bordered">
                                <form id="actionForm" name="actionForm">
                                    <table class="table table-bordered">
                                        <tr>
                                            <td style="width: 10%;">会员昵称</td>
                                            <td style="width: 20%;" th:text="${suit.customerName}">会员昵称</td>
                                            <td style="width: 10%;">是否商户</td>
                                            <td style="width: 20%;" th:text="${suit.isMerchant} == 1 ? '是' : '否'">会员昵称</td>
                                        </tr>

                                        <tr>
                                            <td th:text="${suit.type==1}?'头像':'商标'"></td>
                                            <td>
                                                <img th:src="${suit.headImg}" style="width: 80px; height: 80px;">
                                            </td>
                                            <td>图片</td>
                                            <td>
                                                <img th:src="${suit.imgUrl}" style="width: 80px; height: 80px;">
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>来源</td>
                                            <td th:text="${suit.source}"></td>
                                            <td>类型</td>
                                            <td th:switch="${suit.category}">
                                                <th:block th:case="1">
                                                    流行
                                                </th:block>
                                                <th:block th:case="2">
                                                    引领
                                                </th:block>
                                                <th:block th:case="3">
                                                    时尚
                                                </th:block>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>门面链接</td>
                                            <td th:text="${suit.facadeLink}" colspan="3"></td>
                                        </tr>

                                        <tr>
                                            <td>描述</td>
                                            <td colspan="3">
                                                <th:block th:text="${suit.descrption}"></th:block>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>状态</td>
                                            <td th:switch="${suit.status}" th:if="${type==1} and ${suit.status==0}" colspan="3">
                                                <th:block th:case="0">
                                                    已删除
                                                </th:block>
                                            </td>

                                            <!-- 已审核 -->
                                            <td th:switch="${suit.auditStatus}" th:if="${suit.auditStatus != 0} or ${type==1} and ${suit.status!=0}" colspan="3">
                                                <th:block th:case="0">
                                                    待审核
                                                </th:block>
                                                <th:block th:case="1">
                                                    审核通过
                                                </th:block>
                                                <th:block th:case="2">
                                                    审核不通过
                                                </th:block>
                                            </td>

                                            <!-- 待审核 -->
                                            <td th:switch="${suit.auditStatus}" th:if="${type==2} and ${suit.auditStatus == 0}" colspan="3">
                                                <select class="select selectpicker" name="auditStatus">
                                                    <option value="1">审核通过</option>
                                                    <option value="2">审核不通过</option>
                                                </select>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>审核意见</td>
                                            <td colspan="3">
                                                <input type="hidden" th:value="${suit.id}" name="id">
                                                <textarea th:disabled="${type==1} or ${suit.status==0} or ${suit.auditStatus!=0}" cols="55"
                                                          maxlength="200" rows="7" name="auditDescription" placeholder="请输入审核意见"
                                                          th:text="${suit.auditDescription}"></textarea>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td colspan="4" class="text-center">
                                                <button th:if="${type==2} and ${suit.status==1} and ${suit.auditStatus==0}" type="button" class="btn btn-info" id="btn-submit">
                                                    <span class="fa fa-adjust"> 提交</span>
                                                </button>

                                                <button type="button" class="btn btn-info"
                                                        onclick="history.back();">
                                                    <span class="glyphicon glyphicon-backward"> 返回</span>
                                                </button>
                                            </td>
                                        </tr>
                                    </table>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
<th:block th:include="commons/js::js">Javascript Libs</th:block>
<script>
    $(function () {
        $("#btn-submit").click(function () {
            // 提交表单
            var actionForm = $("#actionForm");
            actionForm.ajaxSubmit({
                type: "post",
                url: ctx + "/suit/updateAuditSuit",
                success: function (rtn) {
                    if (rtn.code != 1) {
                        Alert(rtn.message);
                        return;
                    }
                    Alert("操作成功", function () {
                        document.location.replace(ctx + "/suit/manager");
                    });
                }
            });

        });
    });
</script>
</html>